package com.xinqing.test.LetCode;

/**
 * @Author:CHQ
 * @Date:2021/7/21 15:57
 * @Description
 */
public class MinCostClimbingStairs {
    public static void main(String args[]){
    int[] cost={10,15,20};
    System.out.println(test(cost));
    }
    public static int test(int[] cost){
        for(int i=2;i<cost.length;i++){
            cost[i]=Math.min(cost[i-1],cost[i-2])+cost[i];
        }
        return Math.min(cost[cost.length-2],cost[cost.length-1]);
    }
}
